import java.util.*;
public class Main{
    static class TreeNode{
        TreeNode left;
        TreeNode right;
        String val;
        public TreeNode(String V){
            this.val = V;
        }
    }
    public static TreeNode ans(Queue<String> queue){
        String s = queue.poll();
        if(s.equals("#")){
            return null;
        }
        TreeNode head = new TreeNode(s);
        head.left = ans(queue);
        head.right = ans(queue);
        return head;
    }
    public static TreeNode print(TreeNode head){
        if(head==null){
            return null;
        }
        print(head.left);
        System.out.print(head.val);
        print(head.right);
        return head;
    }
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> list = new LinkedList<>();
        if(root==null){
            return list;
        }
        Stack<TreeNode> stack = new Stack<>();
        TreeNode cur = root;
        stack.push(cur);
        whlie(!stack.isEmpty()){
            if(cur!=null){
                cur = cur.left;
                stack.push(cur);
            }else{
                cur = stack.pop();
                list.add(cur);
                cur = cur.right;
            }
        }
        return list;
    }
    public static void main (String[] args){
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()){
            String s = scanner.nextLine();
            String[] str = s.split("");
            Queue<String> queue = new LinkedList<>();
            for(int i = 0;i<str.length;i++){
                queue.offer(str[i]);
            }
            TreeNode head = ans(queue);
            print(head);
        }
    }
}